GoloScript v0.0.1 is out!
🤓 GoloScript v0.0.1 - dev.20260120.🐻
What’s New in v0.0.1
This release introduces major new features that make GoloScript a powerful tool for AI-driven development:
🔌 Model Context Protocol (MCP) Support
GoloScript now has full support for the Model Context Protocol, enabling you to build both MCP servers and clients directly in GoloScript.
Simple MCP Server Example
Create a tool server that provides stateful operations:
module examples.mcp.SimpleToolsServer
var counter = 0
function main = |args| {
# Create MCP server
let server = mcpCreateServer("my-tools", "1.0.0")
# Define a tool handler
function incrementHandler = |input| {
counter = counter + 1
return map[
["count", counter],
["incremented", true]
]
}
# Register the tool
mcpAddTool(server, "increment", "Increments the counter", incrementHandler)
# Run server on stdio
mcpRunStdio(server)
}
Simple MCP Client Example
Connect to and use the MCP server:
module examples.mcp.SimpleToolsClient
function main = |args| {
# Connect to server
let serverCmd = array["./golo", "examples/mcp/server/simple_tools_server.golo"]
let client = mcpConnectStdio("my-client", serverCmd)
# Call a tool
let result = mcpCallTool(client, "increment", map[])
# Disconnect
mcpDisconnect(client)
}
Key MCP Features:
- Create servers with
mcpCreateServer() - Add tools with
mcpAddTool() - Run over stdio with
mcpRunStdio()or HTTP withmcpRunHttp() - Connect clients with
mcpConnectStdio()ormcpConnectHttp() - Call tools with
mcpCallTool() - Full support for resources and prompts
See the examples/mcp/ directory for complete examples including HTTP servers, resource management, and advanced use cases.
🤖 Ready-to-Use AI Agents
Four pre-built AI agents are now available, making it simple to build intelligent applications:
1. ChatAgent - Conversational AI with Message History
Perfect for building chatbots and conversational interfaces:
module ai.gololang
import gololang.Errors
import gololang.Ai
function main = |args| {
let openAIClient = openAINewClient(
"http://localhost:12434/engines/llama.cpp/v1",
"I💙DockerModelRunner",
"ai/qwen2.5:1.5B-F16"
)
let chatAgent =
ChatAgent()
: name("Assistant")
: client(openAIClient)
: messages(list[])
: systemMessage("You are a helpful assistant.")
# Stream a response
chatAgent: streamCompletion("Who is James T Kirk?",
|chunk| {
print(chunk: content())
return true # Continue streaming
}
)
# Ask a follow-up question (context is maintained)
chatAgent: completion("Who is his best friend?"): either(
|value| -> println(value: content()),
|error| -> println("Error:", error)
)
}
Features:
- Automatic message history management
- Streaming with
streamCompletion() - Standard completion with
completion() - Customizable options (temperature, topP, etc.)
2. RagAgent - Retrieval-Augmented Generation
Build semantic search and RAG systems:
module rag.Agent
import gololang.Errors
import gololang.Ai
function main = |args| {
let openAIClient = openAINewClient(
"http://localhost:12434/engines/llama.cpp/v1",
"I💙DockerModelRunner",
"ai/embeddinggemma:latest"
)
let ragAgent =
RagAgent()
: name("RagAgent")
: client(openAIClient)
: store(list[])
# Add documents to the vector store
let documents = list[
"Squirrels run in the forest",
"Birds fly in the sky",
"Fishes swim in the sea"
]
foreach doc in documents {
ragAgent: saveToStore(doc)
}
# Search for similar documents
ragAgent: searchSimilarity("Which animals swim?", 0.7, 3): either(
|results| {
foreach result in results {
println("Similarity:", result: similarity())
println("Text:", result: entry(): text())
}
},
|error| -> println("Error:", error)
)
}
Features:
- Create embeddings with
createEmbedding()andcreateEmbeddings() - Store documents with
saveToStore() - Semantic search with
searchSimilarity(threshold, maxResults) - Built-in vector similarity calculation
3. StructuredAgent - Guaranteed JSON Output
Generate structured data that conforms to JSON schemas:
module structured.Agent
import gololang.Errors
import gololang.Ai
let openAIClient = openAINewClient(
"http://localhost:12434/engines/llama.cpp/v1",
"I💙DockerModelRunner",
"huggingface.co/menlo/jan-nano-gguf:q4_k_m"
)
# Define JSON Schema
let personSchemaJSON = """
{
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
"occupation": {"type": "string"}
},
"required": ["name", "age", "occupation"]
}
"""
# Configure response format
let responseFormat = DynamicObject()
: type("json_schema")
: jsonSchema(DynamicObject()
: name("person_profile")
: schema(personSchemaJSON)
: strict(true))
let structuredAgent = StructuredAgent()
: name("StructuredAgent")
: responseFormat(responseFormat)
: client(openAIClient)
: messages(list[])
: options(
DynamicObject()
: temperature(0.5)
)
: systemMessage("You always respond in JSON format.")
structuredAgent: completion("Create a profile for a software engineer."): either(
|value| -> println(value: content()),
|error| -> println("Error:", error)
)
}
Features:
- Guaranteed JSON output matching your schema
- JSON Schema validation
- Perfect for data extraction and API responses
4. ToolsAgent - Parallel Tool Calling
Enable AI models to call multiple tools in parallel:
module tools.Agent
import gololang.Errors
import gololang.Ai
function main = |args| {
let openAIClient = openAINewClient(
"http://localhost:12434/engines/llama.cpp/v1",
"I💙DockerModelRunner",
"hf.co/menlo/jan-nano-gguf:q4_k_m"
)
let toolsAgent =
ToolsAgent()
: name("ToolsAgent")
: client(openAIClient)
: messages(list[])
: systemMessage(
"You are a helpful assistant that can perform calculations and greet people."
)
: tools(getTools())
toolsAgent: detectParallelToolCalls(
"Calculate 15+27, say hello to Alice and Bob, then calculate 100-42"
): either(
|value| {
println("Tool calls made:", value: toolCalls(): size())
foreach toolCall in value: toolCalls() {
println("Function:", toolCall: functionName())
println("Arguments:", toolCall: functionArguments())
}
},
|error| -> println("Error:", error)
)
}
function getTools = {
let calculateTool = DynamicObject()
: define("function", DynamicObject()
: define("name", "calculate_sum")
: define("description", "Calculate sum of two numbers")
: define("parameters", DynamicObject()
: define("type", "object")
: define("properties", DynamicObject()
: define("a", DynamicObject()
: define("type", "number"))
: define("b", DynamicObject()
: define("type", "number")))
: define("required", list["a", "b"])))
return list[calculateTool]
}
Features:
- Detect and execute parallel tool calls
- Tool definition using JSON Schema-like format
- Currently supports parallel tool call detection (full tool execution loop coming soon)
🐛 Debug Mode (Experimental)
Enable interactive debugging with the --debug flag:
# Run a script in debug mode
./golo --debug myScript.golo
# Start REPL in debug mode
./golo --debug
When debug mode is enabled, you get enhanced error messages and debugging capabilities to help diagnose issues in your GoloScript programs.
Usage:
# Normal execution
./golo script.golo
# Debug mode execution
./golo --debug script.golo arg1 arg2
Examples
All new features include comprehensive examples:
- MCP Examples:
examples/mcp/client/andexamples/mcp/server/ - AI Agent Examples:
examples.ai/03-functional-ai/